package cn.highedu.rediscli;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Component;

@Component
public class RedisDemo {
    @Autowired
    private StringRedisTemplate redisTemplate;
    public void add() {
        redisTemplate.opsForValue().set("name", "Spring Data Redis");
        String result = redisTemplate.opsForValue().get("name");
        System.out.println(result);
    }
}
